package o;

import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.AsyncTask.Status;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.huawei.appmarket.service.webview.js.ShowLogView;
import o.der.f;
import o.der.g;

public class enq extends cku {
    private ShowLogView ॱ;

    static class a implements OnClickListener {
        private View ˎ;
        private LinearLayout ॱ;

        public a(LinearLayout linearLayout, View view) {
            this.ॱ = linearLayout;
            this.ˎ = view;
        }

        public void onClick(View view) {
            this.ॱ.setVisibility(8);
            this.ˎ.setVisibility(0);
        }
    }

    static class d implements OnClickListener {
        private LinearLayout ˊ;
        private ShowLogView ˋ;
        private View ˎ;
        private Context ˏ;

        public d(Context context, ShowLogView showLogView, LinearLayout linearLayout, View view) {
            this.ˏ = context;
            this.ˋ = showLogView;
            this.ˊ = linearLayout;
            this.ˎ = view;
        }

        public void onClick(View view) {
            if (this.ˋ.ˎ() == null) {
                this.ˋ.ˋ();
            } else if (this.ˋ.ˎ().getStatus() == Status.RUNNING) {
                evk.ˏ(this.ˏ, f.ˏꜟ, 0).ˋ();
            } else {
                this.ˊ.setVisibility(0);
                this.ˎ.setVisibility(8);
            }
        }
    }

    public Dialog onCreateDialog(Bundle bundle) {
        this.ʽ = 8;
        Builder ˋ = ˋ(getActivity());
        ˋ.setPositiveButton(f.ᐝʽ, null);
        View inflate = getActivity().getLayoutInflater().inflate(g.ᐝˊ, null);
        String packageName = getActivity().getPackageName();
        ((TextView) inflate.findViewById(o.der.d.ˈˋ)).setText(packageName);
        try {
            PackageInfo packageInfo = getActivity().getPackageManager().getPackageInfo(packageName, 0);
            if (packageInfo != null) {
                ((TextView) inflate.findViewById(o.der.d.ˉˋ)).setText(String.valueOf(packageInfo.versionName));
            }
        } catch (NameNotFoundException e) {
            Logger.e("SystemLogInfoDialog", "can not find pkg:" + packageName);
        }
        LinearLayout linearLayout = (LinearLayout) inflate.findViewById(o.der.d.ॱꜞ);
        View findViewById = inflate.findViewById(o.der.d.ॱꞌ);
        this.ॱ = new ShowLogView(getActivity(), linearLayout, findViewById);
        inflate.findViewById(o.der.d.ˉˊ).setOnClickListener(new a(linearLayout, findViewById));
        inflate.findViewById(o.der.d.ˉᐝ).setOnClickListener(new d(getActivity(), this.ॱ, linearLayout, findViewById));
        ˋ.setView(inflate);
        Dialog create = ˋ.create();
        ayw.ˊ(create.getWindow());
        return create;
    }

    public void onDestroyView() {
        if (this.ॱ != null) {
            this.ॱ.ˊ();
        }
        super.onDestroyView();
    }
}
